package com.lantu.wisdom.common.utils;

import java.util.Calendar;
import java.util.TimeZone;

/**
 * @Description:
 * @Author: duhui
 * @Date: 2020/7/29 10:16
 */
public class TimeUtil {

    public static Long dayStartTime(Long time){
        long zero = time/(1000*3600*24)*(1000*3600*24) - TimeZone.getDefault().getRawOffset();
        return zero;
    }

    public static void main(String s[]){
        Long time=TimeUtil.dayStartTime(TimeUtil.dayStartTime(System.currentTimeMillis())-1);
        System.out.println(time);
    }

    public static int getDateHour(){
        int type=0;
        String nihao="";
        Calendar cal = Calendar.getInstance();
        int hour = cal.get(Calendar.HOUR_OF_DAY);
        if (hour >= 6 && hour < 8) {
            nihao = "早上好";
            type=1;
        } else if (hour >= 8 && hour < 11) {
            nihao = "上午好";
            type=2;
        } else if (hour >= 11 && hour < 13) {
            nihao = "中午好";
            type=3;
        } else if (hour >= 13 && hour < 18) {
            nihao = "下午好";
            type=4;
        } else {
            nihao = "晚上好";
            type=5;
        }
        return type;


    }

}
